Skip to content

Conversation

ronjalh
Copy link
Member

@ronjalh ronjalh commented Oct 16, 2026 •

Summary

Build a modular, route-backed element detail page using the existing variant and difficulty components.

What's in it

  • Add /elements/:elementId with loading, not-found, and error/retry states.
  • Add focused header, metadata, diagram, and action sections.
  • Load element, apparatus, group, image, and variant data through a local catalog adapter.
  • Reuse ElementVariants and DifficultyBadge; use existing CSS variables for page and badge colors.
  • Add catalog and variant rendering tests, plus the required AI-usage entry.

Choices

The GraphQL server is not implemented yet, so the page reads the checked-in catalog JSON behind a separate adapter that can be replaced with an API client later. No new color values are introduced.

  • src/lib/catalog.ts reads the catalog from data/*.json in the frontend, so the whole catalog goes into the bundle (JS grows from about 224 kB to 496 kB). This is a stand-in until the GraphQL element / catalogItem queries are used.
  • / redirects to a fixed element (UB-1.101-a) while this is the only page.
  • The drawings in data/images are copied to dist/data/images by vite.config.ts on build, so they also work after npm run build.

Testing

  • npm run lint passed.
  • npm run build passed.
  • npm test -- --run: 26 passed, 23 skipped.
  • Focused ElementVariants tests passed after the final badge change.

Not done (still open)

  • The action buttons provide accessible feedback but are not connected to routine navigation or sign-in; see Create "add to gymnast"-button component #47.
  • Replace the local catalog adapter with GraphQL when the server is available.
  • Add page-level tests for loading, error, and not-found states.

Dependencies

This draft is stacked on PR #62, which in turn depends on PR #61. Its temporary base is 48-element-variant-card; retarget it to dev after #62 merges.

Part of #63

Generated with GitHub Copilot

@ronjalh ronjalh self-assigned this Oct 16, 2026
@ronjalh ronjalh force-pushed the 48-element-variant-card branch from 9f23af7 to 41097f6 Compare October 16, 2026 15:47
@ronjalh ronjalh marked this pull request as ready for review October 16, 2026 16:01
@ronjalh ronjalh requested a review from a team as a code owner October 16, 2026 16:01
@anettkva
Copy link
Member

Checked against 48-element-variant-card: it merges cleanly, and lint, type check, build and all 49 tests pass. Two things to fix before merging:

  1. Prettier fails on 11 of the changed files. The new files use double quotes and semicolons, while the repo uses single quotes and no semicolons. Some also lack the final newline. Run npx prettier --write on the changed files.
  2. The drawings are missing in the build. catalog.ts uses /data/images/.... That works in npm run dev, but data/ is not in public/, so the images are not copied into dist/ and all image links break after npm run build.

Fine for now, but please mention it in the PR description:

  • catalog.ts reads the catalog from data/*.json in the frontend. The whole catalog goes into the bundle (JS grows from about 224 kB to 496 kB). That's OK as a stand-in, but it should be replaced by the GraphQL element / catalogItem queries when the API is ready.
  • / redirects to a fixed element (UB-1.101-a). That's OK while this is the only page.

Generated with claude code

… the badge

- Merge 48-element-variant-card (keeps this branch's badge and variant list).
- Prettier on all changed source files (single quotes, no semicolons).
- vite.config.ts copies data/images to dist/data/images on build, so the
  drawings also work after npm run build.
- DifficultyBadge: title and a visually hidden label instead of role=img.
Base automatically changed from 48-element-variant-card to dev October 21, 2026 10:39
# Conflicts:
#	docs/AI_USAGE.md
#	package-lock.json
#	src/App.tsx
#	src/components/ui/DifficultyBadge.tsx
@anettkva anettkva merged commit e266004 into dev Oct 21, 2026
@anettkva anettkva deleted the 63-element-detail-page branch October 21, 2026 10:50
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants